<link rel="stylesheet" href="templates/redactor/css/redactor.css" />
<script src="templates/redactor/redactor.js"></script>
<script type="text/javascript"> 
	$(document).ready(
		function()
		{
			$('#res_about').redactor({ focus: true });
			$('#res_about').redactor({ autoresize: false });
			$('#res_copyright').redactor({ focus: true });
			$('#res_copyright').redactor({ autoresize: false });
			$('#res_tos').redactor({ focus: true });
			$('#res_tos').redactor({ autoresize: false });
			
		}
	);
</script>
<script type="text/javascript">
	$(document).ready(function(){
		$("form#settingpage").submit(function(){
			var name = encodeURIComponent($('#res_name').attr('value'));
			var about = encodeURIComponent($('#res_about').attr('value'));
			var copyr = encodeURIComponent($('#res_copyright').attr('value'));
			var tos = encodeURIComponent($('#res_tos').attr('value'));
			var datastring = 'name=' + name +
							 '&about=' + about +
							 '&copyr=' + copyr +
							 '&tos=' + tos;
			$.ajax({
				url: "setting_process.php",
				type: "POST",
				data: datastring,
				dataType: 'json',
				success: function(){
										$('#success-setting').html("<h1 id='saving'><center><img id='checkmark' src='templates/images/processing.gif' /> Saving Setting... </center></h1>")
										.hide()
										.fadeIn(3500, function() {
										  $('#success-setting').html("<h1 id='saving'><center><img id='checkmark' src='templates/images/check.png' /> Setting Saved!</center></h1>");
										});
										setTimeout(function(){
											$('#success-setting').fadeOut(1500, function() {
												$('#saving').remove();
											});
										},1500);											
									}
			});
			return false;
		});
	});
</script>
<h1>Cấu hình website</h1>
<form id="settingpage" method="post">
    <fieldset>
        <legend>Tên trang web</legend>
        <p>
            <input type="text" id="res_name" value="<?php echo $getSetting['name']; ?>" />
        </p>
    </fieldset>
    <fieldset>
        <legend>Trang About Us</legend>
        <p>
            <textarea id="res_about" style="height:350px;"><?php echo $getSetting['about']; ?></textarea>
        </p>
    </fieldset>
    <fieldset>
        <legend>Trang Copyright</legend>
        <p>
            <textarea id="res_copyright" style="height:350px;"><?php echo $getSetting['cpy']; ?></textarea>
        </p>
    </fieldset>
    <fieldset>
        <legend>Trang ToS</legend>
        <p>
            <textarea id="res_tos" style="height:350px;"><?php echo $getSetting['tos']; ?></textarea>
        </p>
    </fieldset>
    <button id="save" type="submit">Save</button>
</form>
<div id="success-setting"></div>